/**
 * describe:
 *
 * @author chaP
 * @date 2019/04/07
 */
package CodingTest.AC20190407;

public class addDigits {
    int sum = 0;
    public int addDigits(int num){
       int sum =0;
       int x = num;
       while(x>0){
           int m = x%10;
           sum+=m;
           x/=10;
       }
       return sum;

    }

    public static void main(String[] args) {
        addDigits ad = new addDigits();
        System.out.println(ad.addDigits(38));
    }
}
